home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr44 / ppl4c10.zip / ALLOCSEG.C next >
Text File  |  1995-02-06  |  318b  |  16 lines

  1. /* allocseg.c */
  2.  
  3. #include <stdio.h>
  4. #include <malloc.h>
  5. #include <dos.h>
  6.  
  7. int AllocSeg(int Size)
  8. {int Seg;
  9.  char far *Ptr;
  10.  /* allocate far heap */
  11.  Ptr = (char far *) _fmalloc(Size+16);
  12.  if(Ptr==NULL) return 0;
  13.  /* SEG:0 points to buffer */
  14.  Seg = FP_SEG(Ptr) + ((FP_OFF(Ptr)+15)>>4);
  15.  return Seg;
  16. }